/**
 * Created by vincent on 2017/10/12.
 */
moduleDoor.controller("AddDoor", function ($$CambioConfig, $scope, $log, $state, LoadingService, EnumService, ConstantService, EventResource, DialogService) {
    initPage($scope);
    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.currentData = {
        active: true,
        type: "STUDY_MAP"
    };

    $scope.cancel = function () {
        DialogService.close();
    };

    $scope.submit = function () {
        Alert.confirm(function () {
            if ($scope.addEventForm.$valid) {
                //LoadingService.show();
                EventResource.add($scope.currentData, function (result) {
                    $log.debug("活动新增结果", result);
                    DialogService.close();
                    Alert.success();
                    //LoadingService.hide();
                });
            }
        });
    };
});